home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / u_man / cat1 / perl.Z / perl
Encoding:
Text File  |  1998-10-28  |  16.9 KB  |  463 lines

  1.  
  2.  
  3.  
  4.      PPPPEEEERRRRLLLL((((1111))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))           PPPPEEEERRRRLLLL((((1111))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       perl - Practical Extraction and Report Language
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.       ppppeeeerrrrllll [ ----ssssTTTTuuuuUUUU ]      [    ----hhhhvvvv ] [    ----VVVV[:_c_o_n_f_i_g_v_a_r] ]
  13.            [ ----ccccwwww ] [ ----dddd[:_d_e_b_u_g_g_e_r] ] [ ----DDDD[_n_u_m_b_e_r/_l_i_s_t] ]
  14.            [ ----ppppnnnnaaaa ]    [ ----FFFF_p_a_t_t_e_r_n ] [    ----llll[_o_c_t_a_l] ] [ ----0000[_o_c_t_a_l]    ]
  15.            [ ----IIII_d_i_r ] [ ----mmmm[----]_m_o_d_u_l_e ] [ ----MMMM[----]'_m_o_d_u_l_e...' ]
  16.            [ ----PPPP ]       [ ----SSSS    ]      [ ----xxxx[_d_i_r] ]
  17.            [ ----iiii[_e_x_t_e_n_s_i_o_n] ]      [    ----eeee '_c_o_m_m_a_n_d' ] [ --------
  18.        ] [ _p_r_o_g_r_a_m_f_i_l_e ] [ _a_r_g_u_m_e_n_t    ]...
  19.  
  20.       For ease of access, the Perl manual has been split up    into a
  21.       number of sections:
  22.  
  23.           perl          Perl overview    (this section)
  24.           perldelta          Perl changes since previous version
  25.           perlfaq          Perl frequently asked    questions
  26.           perltoc          Perl documentation table of contents
  27.  
  28.           perldata          Perl data structures
  29.           perlsyn          Perl syntax
  30.           perlop          Perl operators and precedence
  31.           perlre          Perl regular expressions
  32.           perlrun          Perl execution and options
  33.           perlfunc          Perl builtin functions
  34.           perlvar          Perl predefined variables
  35.           perlsub          Perl subroutines
  36.           perlmod          Perl modules:    how they work
  37.           perlmodlib      Perl modules:    how to write and use
  38.           perlmodinstall      Perl modules:    how to install from CPAN
  39.           perlform          Perl formats
  40.           perllocale      Perl locale support
  41.  
  42.           perlref          Perl references
  43.           perldsc          Perl data structures intro
  44.           perllol          Perl data structures:    lists of lists
  45.           perltoot          Perl OO tutorial
  46.           perlobj          Perl objects
  47.           perltie          Perl objects hidden behind simple variables
  48.           perlbot          Perl OO tricks and examples
  49.           perlipc          Perl interprocess communication
  50.  
  51.           perldebug          Perl debugging
  52.           perldiag          Perl diagnostic messages
  53.           perlsec          Perl security
  54.           perltrap          Perl traps for the unwary
  55.           perlport          Perl portability guide
  56.           perlstyle          Perl style guide
  57.  
  58.           perlpod          Perl plain old documentation
  59.           perlbook          Perl book information
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      PPPPEEEERRRRLLLL((((1111))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))           PPPPEEEERRRRLLLL((((1111))))
  71.  
  72.  
  73.  
  74.           perlembed          Perl ways to embed perl in your C or C++ application
  75.           perlapio          Perl internal    IO abstraction interface
  76.           perlxs          Perl XS application programming interface
  77.           perlxstut          Perl XS tutorial
  78.           perlguts          Perl internal    functions for those doing extensions
  79.           perlcall          Perl calling conventions from    C
  80.  
  81.           perlhist          Perl history records
  82.  
  83.       (If you're intending to read these straight through for the
  84.       first    time, the suggested order will tend to reduce the
  85.       number of forward references.)
  86.  
  87.       By default, all of the above manpages    are installed in the
  88.       /_u_s_r/_l_o_c_a_l/_m_a_n/ directory.
  89.  
  90.       Extensive additional documentation for Perl modules is
  91.       available.  The default configuration    for perl will place
  92.       this additional documentation    in the
  93.       /_u_s_r/_l_o_c_a_l/_l_i_b/_p_e_r_l_5/_m_a_n directory (or else in the _m_a_n
  94.       subdirectory of the Perl library directory).    Some of    this
  95.       additional documentation is distributed standard with    Perl,
  96.       but you'll also find documentation for third-party modules
  97.       there.
  98.  
  99.       You should be    able to    view Perl's documentation with your
  100.       _m_a_n(1) program by including the proper directories in    the
  101.       appropriate start-up files, or in the    MANPATH    environment
  102.       variable.  To    find out where the configuration has installed
  103.       the manpages,    type:
  104.  
  105.           perl -V:man.dir
  106.  
  107.       If the directories have a common stem, such as
  108.       /_u_s_r/_l_o_c_a_l/_m_a_n/_m_a_n_1 and /_u_s_r/_l_o_c_a_l/_m_a_n/_m_a_n_3, you need    only
  109.       to add that stem (/_u_s_r/_l_o_c_a_l/_m_a_n) to your _m_a_n(1)
  110.       configuration    files or your MANPATH environment variable.
  111.       If they do not share a stem, you'll have to add both stems.
  112.  
  113.       If that doesn't work for some    reason,    you can    still use the
  114.       supplied _p_e_r_l_d_o_c script to view module information.  You
  115.       might    also look into getting a replacement man program.
  116.  
  117.       If something strange has gone    wrong with your    program    and
  118.       you're not sure where    you should look    for help, try the ----wwww
  119.       switch first.     It will often point out exactly where the
  120.       trouble is.
  121.  
  122.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  123.       Perl is a language optimized for scanning arbitrary text
  124.       files, extracting information    from those text    files, and
  125.       printing reports based on that information.  It's also a
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      PPPPEEEERRRRLLLL((((1111))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))           PPPPEEEERRRRLLLL((((1111))))
  137.  
  138.  
  139.  
  140.       good language    for many system    management tasks.  The
  141.       language is intended to be practical (easy to    use,
  142.       efficient, complete) rather than beautiful (tiny, elegant,
  143.       minimal).
  144.  
  145.       Perl combines    (in the    author's opinion, anyway) some of the
  146.       best features    of C, sssseeeedddd, aaaawwwwkkkk,    and sssshhhh,    so people familiar
  147.       with those languages should have little difficulty with it.
  148.       (Language historians will also note some vestiges of ccccsssshhhh,
  149.       Pascal, and even BASIC-PLUS.)     Expression syntax corresponds
  150.       quite    closely    to C expression    syntax.     Unlike    most Unix
  151.       utilities, Perl does not arbitrarily limit the size of your
  152.       data--if you've got the memory, Perl can slurp in your whole
  153.       file as a single string.  Recursion is of unlimited depth.
  154.       And the tables used by hashes    (previously called
  155.       "associative arrays")    grow as    necessary to prevent degraded
  156.       performance.    Perl uses sophisticated    pattern    matching
  157.       techniques to    scan large amounts of data very    quickly.
  158.       Although optimized for scanning text,    Perl can also deal
  159.       with binary data, and    can make dbm files look    like hashes.
  160.       Setuid Perl scripts are safer    than C programs    through    a
  161.       dataflow tracing mechanism which prevents many stupid
  162.       security holes.
  163.  
  164.       If you have a    problem    that would ordinarily use sssseeeedddd or aaaawwwwkkkk
  165.       or sssshhhh, but it    exceeds    their capabilities or must run a
  166.       little faster, and you don't want to write the silly thing
  167.       in C,    then Perl may be for you.  There are also translators
  168.       to turn your sssseeeedddd and aaaawwwwkkkk scripts into    Perl scripts.
  169.  
  170.       But wait, there's more...
  171.  
  172.       Perl version 5 is nearly a complete rewrite, and provides
  173.       the following    additional benefits:
  174.  
  175.       +o Many usability enhancements
  176.            It is now possible to write much    more readable Perl
  177.            code (even within regular expressions).    Formerly
  178.            cryptic variable    names can be replaced by mnemonic
  179.            identifiers.  Error messages are    more informative, and
  180.            the optional warnings will catch    many of    the mistakes a
  181.            novice might make.  This    cannot be stressed enough.
  182.            Whenever    you get    mysterious behavior, try the ----wwww
  183.            switch!!!  Whenever you don't get mysterious behavior,
  184.            try using ----wwww anyway.
  185.  
  186.       +o Simplified grammar
  187.            The new yacc grammar is one half    the size of the    old
  188.            one.  Many of the arbitrary grammar rules have been
  189.            regularized.  The number    of reserved words has been cut
  190.            by 2/3.    Despite    this, nearly all old Perl scripts will
  191.            continue    to work    unchanged.
  192.  
  193.  
  194.  
  195.      Page 3                        (printed 10/23/98)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      PPPPEEEERRRRLLLL((((1111))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))           PPPPEEEERRRRLLLL((((1111))))
  203.  
  204.  
  205.  
  206.       +o Lexical scoping
  207.            Perl variables may now be declared within a lexical
  208.            scope, like "auto" variables in C.  Not only is this
  209.            more efficient, but it contributes to better privacy
  210.            for "programming    in the large".    Anonymous subroutines
  211.            exhibit deep binding of lexical variables (closures).
  212.  
  213.       +o Arbitrarily    nested data structures
  214.            Any scalar value, including any array element, may now
  215.            contain a reference to any other    variable or
  216.            subroutine.  You    can easily create anonymous variables
  217.            and subroutines.     Perl manages your reference counts
  218.            for you.
  219.  
  220.       +o Modularity and reusability
  221.            The Perl    library    is now defined in terms    of modules
  222.            which can be easily shared among    various    packages.  A
  223.            package may choose to import all    or a portion of    a
  224.            module's    published interface.  Pragmas (that is,
  225.            compiler    directives) are    defined    and used by the    same
  226.            mechanism.
  227.  
  228.       +o Object-oriented programming
  229.            A package can function as a class.  Dynamic multiple
  230.            inheritance and virtual methods are supported in    a
  231.            straightforward manner and with very little new syntax.
  232.            Filehandles may now be treated as objects.
  233.  
  234.       +o Embeddable and Extensible
  235.            Perl may    now be embedded    easily in your C or C++
  236.            application, and    can either call    or be called by    your
  237.            routines    through    a documented interface.     The XS
  238.            preprocessor is provided    to make    it easy    to glue    your C
  239.            or C++ routines into Perl.  Dynamic loading of modules
  240.            is supported, and Perl itself can be made into a
  241.            dynamic library.
  242.  
  243.       +o POSIX compliant
  244.            A major new module is the POSIX module, which provides
  245.            access to all available POSIX routines and definitions,
  246.            via object classes where    appropriate.
  247.  
  248.       +o Package constructors and destructors
  249.            The new BEGIN and END blocks provide means to capture
  250.            control as a package is being compiled, and after the
  251.            program exits.  As a degenerate case they work just
  252.            like awk's BEGIN    and END    when you use the ----pppp or ----nnnn
  253.            switches.
  254.  
  255.       +o Multiple simultaneous DBM implementations
  256.            A Perl program may now access DBM, NDBM,    SDBM, GDBM,
  257.            and Berkeley DB files from the same script
  258.  
  259.  
  260.  
  261.      Page 4                        (printed 10/23/98)
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.      PPPPEEEERRRRLLLL((((1111))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))           PPPPEEEERRRRLLLL((((1111))))
  269.  
  270.  
  271.  
  272.            simultaneously.    In fact, the old dbmopen interface has
  273.            been generalized    to allow any variable to be tied to an
  274.            object class which defines its access methods.
  275.  
  276.       +o Subroutine definitions may now be autoloaded
  277.            In fact,    the AUTOLOAD mechanism also allows you to
  278.            define any arbitrary semantics for undefined subroutine
  279.            calls.  It's not    for just autoloading.
  280.  
  281.       +o Regular expression enhancements
  282.            You can now specify nongreedy quantifiers.  You can now
  283.            do grouping without creating a backreference.  You can
  284.            now write regular expressions with embedded whitespace
  285.            and comments for    readability.  A    consistent
  286.            extensibility mechanism has been    added that is upwardly
  287.            compatible with all old regular expressions.
  288.  
  289.       +o Innumerable    Unbundled Modules
  290.            The Comprehensive Perl Archive Network described    in the
  291.            _p_e_r_l_m_o_d_l_i_b manpage contains hundreds of plug-and-play
  292.            modules full of reusable    code.  See
  293.            _h_t_t_p://_w_w_w._p_e_r_l._c_o_m/_C_P_A_N    for a site near    you.
  294.  
  295.       +o Compilability
  296.            While not yet in    full production    mode, a    working    perl-
  297.            to-C compiler does exist.  It can generate portable
  298.            byte code, simple C, or optimized C code.
  299.  
  300.       Okay,    that's _d_e_f_i_n_i_t_e_l_y enough hype.
  301.  
  302.      EEEENNNNVVVVIIIIRRRROOOONNNNMMMMEEEENNNNTTTT
  303.       See the _p_e_r_l_r_u_n manpage.
  304.  
  305.      AAAAUUUUTTTTHHHHOOOORRRR
  306.       Larry    Wall <_l_a_r_r_y@_w_a_l_l._o_r_g>, with the    help of    oodles of
  307.       other    folks.
  308.  
  309.       If your Perl success stories and testimonials    may be of help
  310.       to others who    wish to    advocate the use of Perl in their
  311.       applications,    or if you wish to simply express your
  312.       gratitude to Larry and the Perl developers, please write to
  313.       <_p_e_r_l-_t_h_a_n_k_s@_p_e_r_l._o_r_g>.
  314.  
  315.      FFFFIIIILLLLEEEESSSS
  316.        "/tmp/perl-e$$"      temporary file for -e    commands
  317.        "@INC"          locations of perl libraries
  318.  
  319.  
  320.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  321.        a2p      awk to perl translator
  322.  
  323.        s2p      sed to perl translator
  324.  
  325.  
  326.  
  327.      Page 5                        (printed 10/23/98)
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.      PPPPEEEERRRRLLLL((((1111))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))           PPPPEEEERRRRLLLL((((1111))))
  335.  
  336.  
  337.  
  338.      DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  339.       The ----wwww switch    produces some lovely diagnostics.
  340.  
  341.       See the _p_e_r_l_d_i_a_g manpage for explanations of all Perl's
  342.       diagnostics.    The use    diagnostics pragma automatically turns
  343.       Perl's normally terse    warnings and errors into these longer
  344.       forms.
  345.  
  346.       Compilation errors will tell you the line number of the
  347.       error, with an indication of the next    token or token type
  348.       that was to be examined.  (In    the case of a script passed to
  349.       Perl via ----eeee switches,    each ----eeee    is counted as one line.)
  350.  
  351.       Setuid scripts have additional constraints that can produce
  352.       error    messages such as "Insecure dependency".     See the
  353.       _p_e_r_l_s_e_c manpage.
  354.  
  355.       Did we mention that you should definitely consider using the
  356.       ----wwww switch?
  357.  
  358.      BBBBUUUUGGGGSSSS
  359.       The ----wwww switch    is not mandatory.
  360.  
  361.       Perl is at the mercy of your machine's definitions of
  362.       various operations such as type casting, _a_t_o_f(), and
  363.       floating-point output    with _s_p_r_i_n_t_f().
  364.  
  365.       If your stdio    requires a seek    or eof between reads and
  366.       writes on a particular stream, so does Perl.    (This doesn't
  367.       apply    to _s_y_s_r_e_a_d() and _s_y_s_w_r_i_t_e().)
  368.  
  369.       While    none of    the built-in data types    have any arbitrary
  370.       size limits (apart from memory size),    there are still    a few
  371.       arbitrary limits:  a given variable name may not be longer
  372.       than 255 characters, and no component    of your    PATH may be
  373.       longer than 255 if you use ----SSSS.  A regular expression may not
  374.       compile to more than 32767 bytes internally.
  375.  
  376.       You may mail your bug    reports    (be sure to include full
  377.       configuration    information as output by the myconfig program
  378.       in the perl source tree, or by perl -V) to
  379.       <_p_e_r_l_b_u_g@_p_e_r_l._c_o_m>.  If you've succeeded in compiling    perl,
  380.       the perlbug script in    the utils/ subdirectory    can be used to
  381.       help mail in a bug report.
  382.  
  383.       Perl actually    stands for Pathologically Eclectic Rubbish
  384.       Lister, but don't tell anyone    I said that.
  385.  
  386.      NNNNOOOOTTTTEEEESSSS
  387.       The Perl motto is "There's more than one way to do it."
  388.       Divining how many more is left as an exercise    to the reader.
  389.  
  390.  
  391.  
  392.  
  393.      Page 6                        (printed 10/23/98)
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.      PPPPEEEERRRRLLLL((((1111))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))           PPPPEEEERRRRLLLL((((1111))))
  401.  
  402.  
  403.  
  404.       The three principal virtues of a programmer are Laziness,
  405.       Impatience, and Hubris.  See the Camel Book for why.
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.      Page 7                        (printed 10/23/98)
  460.  
  461.  
  462.  
  463.